<?php
class register_m extends CI_Model {
	
	function simpan(){
		$this->db->select_max('id_user','max_id');
		$id_la = $this->db->get('user');
		foreach ($id_la->result() as $id_ba){
			$id_lam = $id_ba->max_id;
		}
		if ( $id_lam==0 ){
			$id_bar = 10001;
		}
		else {
			$id_bar = $id_lam+1;
		}
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$pass = md5($this->input->post('pass'));
		
		$db = array(
			'id_user' => $id_bar,
			'nama' => $nama,
			'email' => $email,
			'password' => $pass
		);
		$sim = $this->db->insert('user',$db);
		return $sim;
	}
}
?>